﻿using Abp.Domain.Entities.Auditing;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;

namespace SingleUserMall.Authorization.Users
{
    /// <summary>
    /// 用户提现
    /// </summary>
    public class UserCash : FullAuditedEntity<long>
    {
        /// <summary>
        /// 用户id
        /// </summary>
        public long UserId { get; set; }
        [ForeignKey("UserId")]
        public virtual User User { get; set; }
        /// <summary>
        /// 银行卡姓名
        /// </summary>
        public string CardName { get; set; }
        /// <summary>
        /// 银行卡号
        /// </summary>
        public string CardNumber { get; set; }
        /// <summary>
        /// 银行编码
        /// </summary>
        public string BankCode { get; set; }
        /// <summary>
        /// 银行名称
        /// </summary>
        public string BankName { get; set; }
        /// <summary>
        /// 提现金额
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 提现状态
        /// </summary>
        public CashStatus Status { get; set; }
        /// <summary>
        /// 提现订单编号
        /// </summary>
        public string OrderNo { get; set; }
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; set; }
        /// <summary>
        /// 提现类型
        /// </summary>
        public CashType CashType { get; set; }
        /// <summary>
        /// 审核状态
        /// </summary>
        public UserCashVerifyStatus VerifyStatus { get; set; }
    }

    public enum CashStatus : int
    {
        [Description("银行退票")]
        BankFailed = -2,
        [Description("失败")]
        Failed = -1,
        [Description("初始化")]
        Init = 0,
        [Description("正在执行")]
        Processing = 1,
        [Description("提现成功")]
        Success = 2
    }

    public enum CashType : int
    {
        [Description("佣金提现")]
        Commision = 1,
        [Description("红包提现")]
        RedPacket = 2,
        [Description("可用体验金提现")]
        CanUsePoint = 3,
    }

    /// <summary>
    /// 审核状态
    /// </summary>
    public enum UserCashVerifyStatus
    {
        /// <summary>
        /// 已驳回
        /// </summary>
        [Description("已驳回")]
        Rejected = -1,
        /// <summary>
        /// 等待审核
        /// </summary>
        [Description("待审核")]
        WaitAudit = 0,
        /// <summary>
        /// 已审核
        /// </summary>
        [Description("已通过")]
        Audited = 1,
    }
}
